package com.example.community.entity;

//import com.baomidou.mybatisplus.annotation.IdType;
//import com.baomidou.mybatisplus.annotation.TableId;
//import com.baomidou.mybatisplus.annotation.TableName;
//import io.swagger.annotations.ApiModel;
//import io.swagger.annotations.ApiModelProperty;
import com.example.community.util.Names;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;

//import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

//@Entity
@Builder
@AllArgsConstructor
@Data
//@Table(name="t_text_content")
//@ApiModel("texcontent")
//@TableName("t_text_content")

//        "text_content",
@Document(indexName = Names.text_content,
        shards = 4, replicas = 2)      // es搜索引擎
public class TextContentEs implements Serializable {
//    public  static  class Names{
//        public  static String  id="id";
//        public  static String  content="content";
//        public  static String  create_time="create_time";
//
//    }
//    Names.TextContentEs

    @Override
    public String toString() {
        return "TextContent{" +
                "id=" + id +
                ", content='" + content + '\'' +
                ", createTime=" + createTime +
                '}';
    }

    private static final long serialVersionUID = -1279530310964668131L;

    public TextContentEs(){

    }

    public TextContentEs(String content, Date createTime) {
        this.content = content;
        this.createTime = createTime;
    }

    @Id
//    @Id
//    @ApiModelProperty("id")
//    @TableId(type = IdType.AUTO)
//    @GeneratedValue(strategy = GenerationType.IDENTITY)
//    private Integer id;
    private String id;

    /**
     * 内容(Json)
     */
    private String content;

    /**
     * 创建时间
     */
    private Date createTime;

//    public Integer getId() {
//        return id;
//    }
//
//    public void setId(Integer id) {
//        this.id = id;
//    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content == null ? null : content.trim();
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
